<template>
  <div>
    <a-tabs defaultActiveKey="1">
      <a-tab-pane :tab="$t('key.personalInfo')" key="1">
        <stu-info :xh.sync="xh" :checked="true"></stu-info>
      </a-tab-pane>
      <a-tab-pane :tab="$t('key.personalResume')" key="2">
        <stu-resume :xh.sync="xh" :checked="true"/>
      </a-tab-pane>
      <a-tab-pane :tab="$t('key.socialRelations')" key="3">
        <stu-relation :xh.sync="xh" :checked="true"/>
      </a-tab-pane>
    </a-tabs>
    <a-form :form="form">
      <a-row>
        <a-col :md="10" :sm="24">
         <a-form-item
            :label="$t('key.reviewResult')"
            :labelCol="{span: 6}"
            :wrapperCol="{span: 15, offset: 1}"
          >
            <a-select  v-decorator="[
              'statusCode',
              {
                rules: [{ required: true, message: '请选择审核结果!' }],
                initialValue:'02'
              }
            ]" allowClear>
              <template v-for="i in TYPE0124">
                <a-select-option v-if="i.code !== '01'" :key="i.id" :value="i.code">{{ i.name }}</a-select-option>
              </template>
            </a-select>
          </a-form-item>
        </a-col>
      </a-row>
      <a-form-item :label="$t('key.note')" :labelCol="{span: 2}" :wrapperCol="{span: 12, offset: 1}">
        <a-input type="textarea" v-decorator="['explain']" :autosize="{ minRows: 2, maxRows: 6 }"/>
      </a-form-item>
    </a-form>
    <a-row style="text-align:center;margin:30px;">
      <a-button :loading="loading" type="primary" @click="saveForm">{{ $t('button.audit') }}</a-button>
    </a-row>
  </div>
</template>

<script>
import stuInfo from './stuInfo'
import stuRelation from './stuRelation'
import stuResume from './stuResume'
import { mapState } from 'vuex'

export default {
  components: {
    stuInfo,
    stuRelation,
    stuResume
  },
  data () {
    return {
      post: {},
      loading: false
    }
  },
  computed: {
    ...mapState({
      TYPE0124: state => state.app['TYPE0124'] // 审核状态
    }),
    xh () {
      return this.$route.query.xh
    }
  },
  beforeCreate () {
    this.form = this.$form.createForm(this)
  },
  created () {
    this.$store.dispatch('app/setDictionary', 'TYPE0124')
    // this.$api.student.studentBcInfo(this.xh).then(res => {
    //   this.studentData = res.data
    // })
  },
  methods: {
    saveForm () {
      this.form.validateFields((err, values) => {
        if (err) {
          return
        }
        this.loading = true
        this.$api.student.supplementCheck(Object.assign({xh: this.xh}, values, {explain: values.explain || ''})).then(res => {
          this.$message.success(res.msg)
          this.$router.back()
        }).finally(() => {
          this.loading = false
        })
      })
    }
  }
}
</script>

<style>

</style>
